package com.jn.algorithm.day018.question55;

/**
 * @author 江南大学1033190417
 * @date 2022/5/9 22:29
 */
public class Solution {
    //贪心
    public boolean canJump(int[] nums) {
        int n = nums.length;
        int pos = n - 1;
        for (int i = n - 1; i >= 0; i--) {
            if (i + nums[i] >= pos) {
                pos = i;
            }
        }
        return pos == 0;
    }
}
